Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> p:first-child { background-color: yellow; } </style> </head> <body> <p>This paragraph is the first child of its parent (body).</p> <h1>Welcome to My Homepage</h1> <p>This paragraph is not the first child of its parent.</p> <div> <p>This paragraph is the first child of its parent (div).</p> <p>This paragraph is not the first child of its parent.</p> </div> <p><b>Note:</b> For :first-child to work in IE8 and earlier, a DOCTYPE must be declared.</p> </body> <!-- Mirrored from www.w3schools.com/cssref/tryit.asp?filename=trycss_sel_firstchild by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:13:58 GMT --> </html>
Result:
Try it Yourself - © w3schools.com